{assign var=n value=1}
{assign var=nb value=2}

{if !is_null($user)}
    <div id="saveButton">
        <ul class="saveButtons">
            <li class="first">
                <a href="{$user->getGroupEditUrl()}" class="reload active" title="">
                    {icon name="menu_up.png" title=""} {t}Users list{/t}
                </a>
            </li>
            <li>
                <a href="{$user->getGroupEditUrl('$user->getLang()', 'roles')}" class="reload active" title="">
                    {icon name="menu_up.png" title=""} {t}Group rights{/t}
                </a>
            </li>
        </ul>
    </div>
{/if}
<div id="Rights">
<table>
<tr>
    {foreach from=$rights key=title item=right name=foreachRightsBlock}
        {if $n == 1}<td>{/if}
            {assign var=module value=$right.0.module}
            <br/>
            <div class="rights_block">
                <div class="rights_block_title">{$title}</div>
                <div class="rights_block_actions">
                    {if !$isSuperGroup}
                        {hasRight rule=rights_Edit}
                        {icon name="unactive_right.png" size="16" title="Rien autoriser" class="icon16 editable" onclick="changeGroupRights($group, '$module', 'false')" }
                        {icon name="active_right.png" size="16" title="Tout autoriser" class="icon16 editable" onclick="changeGroupRights($group, '$module', 'true')"}
                        {icon name="refresh.png" size="16" title="Inverser" class="icon16 editable" onclick="changeGroupRights($group, '$module', 'mid')"}
                        {/hasRight}
                    {/if}
                </div>
                <div style="clear:both"></div>
                <table id="tab_{$module}">
                {foreach from=$right item=value}
                    <tr>
                        <td class="rights_block_td_img" id="rights_Rights_{$value.name}_acces" {if $value.inherit == false && !$isSuperGroup}{hasRight rule=rights_Edit}class="editable" onclick="changeRights({$group} ,'{$value.name}')"{/hasRight}{/if}>
                            {if $value.inherit == true}
                                {icon name="active_right2.png" size="16" class="icon16 inherit"}
                            {elseif $value.access == true}
                                {icon name="active_right.png" size="16" class="icon16"}
                            {else}
                                {icon name="unactive_right.png" size="16" class="icon16"}
                            {/if}
                        </td>
                        <td class="rights_block_td_text" id="rights_Rights_{$value.name}_droit">{if $value.label != ""}{$value.label}{/if}</td>
                    </tr>
                {/foreach}
                </table>
            </div>
            {assign var=n value=$n+1}

            {if $n > $nb}
            {assign var=n value=1}
            </td>
            {/if}
        {/foreach}
</tr>
</table>
</div>